<?php
header("Content-type: text/html; charset= UTF-8");
require_once '../../includes/global.php';
header("Content-type: text/html; charset= UTF-8");

/*
 * 数据配置模块
 * 	只有admin用户可进入
 */
if ($_GET['did']=='2' && $_SESSION['userinfo']['user']!='admin'){
    die('只有超级管理员可修改此模块!');
}

if($_GET['model']=='del') {
	if($_SESSION['logined']!=1) {
		die('您还没登陆或登陆超时!');
	}
	$del['del']=1;
	foreach ($_POST['del'] as $del_key => $del_val){
		Du($_POST['table'],$del,'id',$del_key);
	}
	exit;
}
//error_reporting(E_ALL);

//Jc('g');
//配xajax
/*
addXajax('u2sdfsf');
addXajax('u2sdfsf2');
$printXajax=addXajax('updatetag');

function updatetag($name, $did)
{
	$objResponse = new xajaxResponse();
	$objResponse->sEncoding = "utf-8";
	$_SESSION[$did] = $name;
	$objResponse->assign('loading', "innerHTML", "");
	return $objResponse;
}
function u2sdfsf()
{
	$b = new xajaxResponse();
	$b->alert('b');
	return $b;
}
function u2sdfsf2()
{
	$b = new xajaxResponse();
	$b->alert('b2');
	return $b;
}
*/
//
//$xajax = new xajax();
//$xajax->bDecodeUTF8Input=true;
//
//$xajax->registerFunction("updatetag");
//$xajax->processRequests();
//得到配置文件
$wcfg = Dga('wcfg', "web like '".$sitename."' and lg like 'zh'");
$wcfg = json_decode($wcfg[wcfg], true);
$dcfg = Dga('dcfg', "id like '".$_GET[did]."'");
$dcfg = json_decode($dcfg[dcfg], true);
$_SESSION[$dcfg['name']] == '' && $_SESSION[$dcfg['name']] = '1';
$xuan = array ();
$yin = array ();
$search = array ();
$condition = array ();
$ban=array();
$bgcolor=array('#D1DEF1','#FFECD2','#FFECF5','#E8FFFD','#D1DEF1','#FEDDD3','#E4D0CF','#DDDDFF','#EEFFCC');
foreach ($dcfg[structure] as $dkey=>$dvalue) {
	//屏蔽
	if ($dvalue['ban']==1){
		$ban[]=$dkey;
	}
	//yinxuan
	switch($dvalue['show']) {
		case 1: {
				$xuan[$dkey] = $dvalue['COMMENT'];
				break;
			}
		case 2: {
				$yin[$dkey] = $dvalue['COMMENT'];
				break;
			}
		default: {
				break;
			}
	}
	//search
	switch($dvalue['search']) {
		case 1: {
				$search[$dkey] = $dvalue['COMMENT'];
				$_GET[$_GET['lg']][$dkey] != '' && $condition[$_GET['lg']] .= " and ".$dkey." like '%".$_GET[$_GET[lg]][$dkey]."%' ";
				break;
			}
		case 2: {
				$search[$dkey] = $dvalue['COMMENT'];
				$_GET[$_GET[lg]] != '' && $condition[$_GET['lg']] .= " and ".$dkey." like '%".$_GET[$_GET[lg]][$dkey]."%' ";
				break;
			}
		case 3: {
				$search[$dkey] = $dvalue['COMMENT'];
				sort($_GET[$_GET[lg]][$dkey]);
				$tseslec = implode(',', $_GET[$_GET[lg]][$dkey]);
				//Jc($_GET[$_GET[lg]][$dkey]);
				$tseslec != '' && $tseslec != '0' && $condition[$_GET['lg']] .= " and INSTR(".$dkey.",',".$tseslec.",')>0  ";
				break;
			}
		case 4:
			/***
			 * 专门给my97的时间搜索用的
			 * @var
			 */
				$search[$dkey] = $dvalue['COMMENT'];
				$cuo=strtotime($_GET[$_GET[lg]][$dkey]);//转为时间戳
				if($cuo!=''){
					$My97Start=strtotime(date("Y-m-d",$cuo));//开始时间
					$My97End=strtotime(date("Y-m-d",$cuo))+INT_DAY;//一天后的时间
					$_GET[$_GET[lg]] != '' && $condition[$_GET['lg']] .= " and ".$dkey." >= '".$My97Start."'  and ".$dkey." < '".$My97End."' ";
				}
				break;
		default: {
				break;
			}
	}
	//附加功能
	if ($dvalue['ftype'] == 'bind') {
		if($dvalue['filter']['open']==1 && $dvalue['filter']['data']!=''){
			$dvalue['filter']['COMMENT'] = $dvalue['COMMENT'];
			$bind_filter[$dkey] = $dvalue['filter'];
			$bind_filter_tmp=preg_split("/,|#/",$dvalue['filter']['data']);
			foreach($bind_filter_tmp as $bind_filter_tmp_v){
				$bind_filter_arr[] = $bind_filter_tmp_v;
			}
		}else{
			$bind[$dkey] = $dvalue['COMMENT'];
		}
	}
	//推荐属性
	if ($dvalue['ftype'] == 'recommend') {
		$recommend[$dkey] = $dvalue['COMMENT'];
		$dvalue['order']['comment'] = $dvalue['COMMENT'];
		if($dvalue['order']['open']==1){
			$order[$dkey]=$dvalue['order'];
		}
	}
	//分类式信息浏览
	if ($dvalue['ftype'] == 'dselect') {
		$fen = true;
	}
	//自定义的-龙
	if($dvalue['ftype']=='tuiBic'){
			$recommendbic[$dkey]=$dvalue['COMMENT'];
				}

	//浏览数值需要转换
	switch($dvalue['change']) {
		case 'yinyong': {
				$yinyong[] = $dkey;
				break;
			}
		case 'datetime': {
				$datetime[] = $dkey;
				break;
			}
		case 2: {
				$search[$dkey] = $dvalue['COMMENT'];
				$_GET[$_GET[lg]] != '' && $condition[$_GET['lg']] .= " and ".$dkey." like '%".$_GET[$_GET[lg]][$dkey]."%' ";
				break;
			}
		default: {
				break;
			}
	}

	//全局时间格式化
	if($dvalue['datetimeChange']==1){
		$datetimeChange[$dkey]['field']=$dkey;
		$datetimeChange[$dkey]['globalformat']=$dvalue['globalformat'];
	}

}
//Jc($order);

//Jc($wcfg['ping']);
//Jc($wcfg);
//Jc($dcfg);exit;
//检测多语言屏蔽
if (array_key_exists($_GET['did'], $wcfg['ping'])) {
	$wcfg['num'] = 1;
	$temp = $wcfg['lang'][$wcfg['ping'][$_GET['did']]];
	unset ($wcfg['lang']);
	$wcfg['lang'][$wcfg['ping'][$_GET['did']]] = $temp;
}
/*
 * 当前语言环境
 * -Bic	2009年8月13日 14时29分51秒
 */
!$_GET['lg'] && $_GET['lg']='zh';

/**
 *生成信息预览链接
 * 信息预览专用
 * @global array $temp
 * @param array $matches
 * @return string
 */
function get_visit_link($matches){
    global $temp;
    return $matches[1].$temp[$matches[2]].$matches[3];
}
//开启用户信息分类功能
$noCheck=array();
//$noCheck=array('admin','root');//用户过渡表
//Jc($wcfg);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Prosperous JIMU</title>
        <?php
        echo $printXajax;
        ?>
        <link href="../css/mod.css" rel="stylesheet" type="text/css" />
		<script src="/admin/js/jquery.js" type="text/javascript"></script>
		<script src="/jimu/My97/WdatePicker.js" type="text/javascript"></script>
        <link  href="/jimu/lytebox/lytebox.css"  rel="stylesheet" type="text/css" />
        <script src="/jimu/lytebox/lytebox.js" type="text/javascript" ></script>

        <!--<script type="text/javascript">parent.document.getElementById('loading').innerHTML = '正在加载UI组建...';</script>
        !-->
        <script language="javascript">
            if (top.location == self.location)
                alert('此路不通');
            window.close();
        </script>
        <script language="javascript">
            window.onload = function(){
                var str1 = "?";
                var links = document.getElementsByTagName("A")||document.all.tags("A");
                var total = links.length;
                for (i = 0; i < total; i++) {
                    var s = links[i].href.indexOf(str1);
                    if (s > 0) {
                        links[i].href = links[i].href + '&from=b&mid=<?php echo $_GET[mid];?>';
                    }
                    else {
                        links[i].href = links[i].href + '?from=b&mid=<?php echo $_GET[mid];?>';
                    }
                }
            }
        </script>
    </head>
    <body>
        <div id="container">
        <div id="title">
            <ul>
                <?php
                $i = 1;
				if (is_array($wcfg['lang'])) {
					foreach ($wcfg[lang] as $key=>$lg) {
						if ($key == $_GET['lg']) {
							$lg_num=$i;
							$temp1 = "class='selectli{$i}'";
							$temp2 = "class='selectspan{$i}'";
						} else {
							$temp1 = "";
							$temp2 = "";
						}

						echo "<li id=\"tag".$i."\"><a href=\"###\" onclick=\"switchTag('tag".$i."','content".$i."');this.blur();\" {$temp1}><span {$temp2}>".$dcfg['title']."【".$lg."】</span></a></li>";
						$i++;
					}
                }
                ?>
            </ul>
<script type="text/javascript">
<!--
function switchTag(tag,content){
	var allnum=<?php echo $wcfg[num];?>;
	for(i=1; i <= allnum; i++)
	{
		if ("tag"+i==tag)
		{
			document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;
			document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="selectspan"+i;
		}else{
			document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";
			document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="";
		}
		if ("content"+i==content)
		{
			document.getElementById(content).className="";
		}else{
			document.getElementById("content"+i).className="hidecontent";
		}
		document.getElementById("content").className=content;
	}
}

var out_background='';
var select_background='#DEC47A';
function click_for_tr(i) {
	//$('#tr_'+i).css('background',select_background);
	var tr=$('#del_'+i);
	if (tr.attr('checked')) {
		tr.attr('checked',false);
	}else{
		tr.attr('checked',true);
	}
}
//-->
</script>
        </div>
        <div id="content" class="content<?php echo $lg_num; ?>">
        <div id="loading">
        </div>
        <?php
        $xhgs = 1;
	if (is_array($wcfg['lang'])) {
        foreach ($wcfg[lang] as $lgk=>$lgv) {
        	$nowbgcolor=$bgcolor[$xhgs-1];
        	//if ($xhgs == 1) {
        		//echo " <div id=\"content".$xhgs."\" >";
        	//} else {
        		//echo "<div id=\"content".$xhgs."\" class=\"hidecontent\">";
        	//}

			$tmp_class='';
			//echo $lgk;
			if($lgk!=$_GET['lg']){
				$tmp_class="class='hidecontent' ";
			}
			echo "<div id=\"content{$xhgs}\" {$tmp_class} >";
        	echo "<fieldset><legend><img src='../img/find.gif' border='0'  style='display:left;vertical-align:middle;' ait='检索' /> 〖".$dcfg[title]."-{$_GET['did']}〗检索〖SEARCH〗</legend>";
        	//内容开始
        ?>
        <form action="l.php" method="get" enctype="multipart/form-data" id="vform">
            <?php
            //Jc('g');

			 foreach($search as $key => $value){
            	//屏蔽功能
            	if(in_array($key,$ban)){
            		continue;
            	}
			 	echo "<span style=\"float:left;width:300px;\">";
			 	echo "<span style=\"float:left;width:80px;padding-top:6px;\">";
			 	$dcfg['structure'][$key]['ftype']($key,$lgk,0,0);
			 	echo "</span>";
				echo ":&nbsp;";
                switch($dcfg['structure'][$key]['ftype']){
                    case 'select':
                        select_for_search($key,$lgk,1,0,$_GET[$lgk][$key]);
                        break;
                    case 'radio':
                        radio_for_search($key,$lgk,1,0,$_GET[$lgk][$key]);
                        break;
                    default:
                        $dcfg['structure'][$key]['ftype']($key,$lgk,1,0,$_GET[$lgk][$key]);

                }
				echo "</span>";
			 }
            ?>
            <input type="hidden" value="<?php echo $_GET['did'];?>" name='did'/><input type="hidden" value="<?php echo $_GET['bdb'];?>" name='bdb'/><input type="hidden" value="<?php echo $_GET['mid'];?>" name='mid'/><input type="hidden" value="b" name='from'/><input type="hidden" value="<?php echo $_GET['bdid'];?>" name='bdid'/><input type="hidden" value="<?php echo $lgk;?>" name='lg'/><input name="SEARCH" value="检索" type="submit" />
        </form>
        <br/>
        <br/>
        <div style="float:left;">
        <?php
        /*##########################
         * 	排序
         * #########################
         **/
        foreach($order as $reK=>$reV){
            if ($_GET['bdb']!=''){
                $bd_con="&bdb={$_GET['bdb']}";
            }
            if ($_GET['bdid']!=''){
                $bd_con.="&bdid={$_GET['bdid']}";
            }
            if ($reV['full_table_order']==1){
                $bd_con.="&full_table_order=1";
            }
        	echo <<<EQT
			<span style="padding:0 5px;white-space:nowrap;">
				<a href="javascript:void(0);"
					onclick='window.parent.tab.add({"id":"order_{$reK}","title":"排序[{$reV['comment']}]",closable:true,html:"<iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"/admin/mod/o.php?did={$_GET['did']}{$bd_con}&orderfield={$reK}&field={$reV['field']}&order={$reV['order']}&lg={$lgk}&debug={$dcfg['debug']}&comment={$dvalue['COMMENT']}&from=b&mid={$_GET['mid']}\"></iframe>"});window.parent.tab.setActiveTab("order_{$reK}");'><b>{$reV['comment']}</b>排序</a></span>
EQT;
        }
        ?>
        </div>
        </fieldset>
        <br/>
        <?php

		/*绑定表__bic
		 * 下面的修改查看也要用到
		 */
		$isbdda3b=$_GET['bdb']!=''?'&bdb='.$_GET['bdb']:'';
		$_GET['bdid']!=''?$isbdda3b.='&bdid='.$_GET['bdid']:'';

        $topage=$_GET['did']==2 ? "dataset" : "c";
		//添加按钮
		//是否可以添加
		$add='';
		if(($dcfg['add']!=1 || in_array($_SESSION['userinfo']['user'],$noCheck)) && 'zh'==$lgk){
			$add="<a href='".$topage.".php?did=".$_GET['did'].$isbdda3b."' title='添加【ADD】'><img src='../img/add.gif' border='0' ait='添加【ADD】'></a>";
		}
		//父级添加按钮
		//是否可以添加
		if($dcfg['parent_add']!=1 || in_array($_SESSION['userinfo']['user'],$noCheck)){
			$parent_add="<a href='c.php?did=".$_GET['bdb']."' title='添加父类信息【AddParent】'><img src='../img/folder_new.gif' border='0' ait='添加父类信息【AddParent】'></a>";
		}
		//父级查看按钮
		//是否可以返回
		if($dcfg['parent_view']!=1 || in_array($_SESSION['userinfo']['user'],$noCheck)){
			$parent_view="<a href='l.php?did=".$_GET['bdb']."' title='列表父类信息【ListParent】'><img src='../img/note.gif' border='0' ait='列表父类信息【ListParent】'></a>";
		}

        if ($fen == true) {
        	$fen = "<a href='sort.php?did=".$_GET['did']."'  title='分类目录式浏览【LIST】'><img src='../img/list.gif' border='0' ait='分类目录式浏览【LIST】'></a>";
        }
        echo $fen.(($_GET['bdb'])?(" {$parent_add} {$parent_view}"):
        	(""))."       {$add}   <a href='#' onclick=\"location.reload();\" title='刷新【REFRESH】'><img src='../img/page_refresh.gif' border='0' ait='刷新【REFRESH】'></a> ".(($_SERVER['HTTP_REFERER'] && (substr($_SERVER['HTTP_REFERER'], -1, 1) != '/') && !Sf('index.php', $_SERVER['HTTP_REFERER']))?("<a href='".$_SERVER['HTTP_REFERER']."'  title='后退【BACK】'><img src='../img/arrow_rotate_anticlockwise.png' border='0' ait='后退【BACK】'></a>"):
        			(""))."";
        ?>
		<form  id="l_form_id_<?php echo $lgk;?>" action="javascript:void(0);" >
        <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#999999" style="border-collapse: collapse">
            <tr>
            </tr>
            <!-- 表头 !-->
            <tr>
            </tr>
            <tr>
                <td align='center'>
                    选择
                </td>
                <?php
                if ($dcfg['visit']['switch']){
                ?>
                <td align='center'>
                    查看
                </td>
                <?php
                }
                foreach ($xuan as $key=>$value) {
	            	//屏蔽功能
            		if(in_array($key,$ban)){
            			continue;
            		}

            		//字段排序
            		$field_order=$field_order_field=$field_order_arrowhead='';

        		    if($_GET["field_order_field"] == $key){
        		        $_GET["field_order"] || $_GET["field_order"] = 'asc';
        		        $field_order = $_GET["field_order"] == 'asc'?'desc':'asc';
            		    $field_order = "&field_order={$field_order}";
        		        $field_order_arrowhead = $_GET["field_order"] == 'desc'?'↓':'↑';
        		    }

                	echo "<td height='30' align='center'><a style='color:#000' href='l.php?field_order_field={$key}{$field_order}&".get_url_parameter("field_order,field_order_field")."'>{$value}&nbsp;<b>{$field_order_arrowhead}</b></a></td>";
                }
                ?>
                <td height='30' align='center'>
                    操作〖OPERATE〗
                </td>
            </tr>
            <?php


			if($dcfg['self']!='' && !in_array($_SESSION['userinfo']['user'],$noCheck)){
				$condition[$lgk]=" and ".$dcfg['self']." like '".$_SESSION['userinfo']['user']."'";
			}

			//后台自定义条件
			if(strpos($dcfg['cmsCon'],':') !== false){
    			eval(substr($dcfg['cmsCon'],1));
			}
			$condition[$lgk].=$dcfg['cmsCon']!=''?' '.$dcfg['cmsCon'].' ':'';	//加了两个空格



            /**
             * 多城市模块过滤
             */
            if(defined('MULTI_CITY') && MULTI_CITY && $_SESSION['userinfo']['user']!='admin'){
                //$dvalue=get_user_city();
                //$condition[$lgk].=" and city={$dvalue}";
            }


            !$_REQUEST[page] && $_GET[page] = 1;
            $_REQUEST[page] && $_GET[page] = $_REQUEST[page];
            //配置搜索
            $pageline = $dcfg['pageline'];
            //$pageline=1;
            !$_GET['del'] && $_GET['del'] = 1;
            $_GET['bdb'] && $condition[$lgk] .= " and bdb like '".$_GET['bdb']."'  ";
            $_GET['bdid'] && $condition[$lgk] .= " and bdid = '".$_GET['bdid']."'  ";

            $sql = "SELECT count(id) as num
            FROM ".$wcfg['prefix']."_".$dcfg['name']." AS A

            where 1   and A.del!='".$_GET[del]."' and sortid={$_GET['did']} and A.lg='".$lgk."' ".$condition[$lgk]."   ";
            //echo $sql;
            $res = mysql_query($sql);
            $temp = mysql_fetch_array($res);
            //$ttt->assign('znum',$temp[num]);
            $ajaxpage = new lm_page( array ('total'=>$temp[num], 'perpage'=>$pageline, 'page_name'=>'page'.$lgk));
            mysql_free_result($res);
            if ($_GET['page'.$lgk] == '') {
            	$_GET['page'.$lgk] = 1;
            }

            //排序功能
            if(strrpos($condition[$lgk],'order by')===false){
                if ($_GET["field_order_field"]){
                    $condition[$lgk] .= " order by {$_GET["field_order_field"]} {$_GET["field_order"]}";
                }else{
            	    $condition[$lgk] .= '  order by id desc  ';
                }
            }

            $sql = "
            SELECT *
            FROM ".$wcfg['prefix']."_".$dcfg['name']." AS A
            where 1   and A.del!='".$_GET[del]."' and sortid={$_GET['did']} and A.lg='".$lgk."' ".$condition[$lgk]."   LIMIT ".($_GET['page'.$lgk]-1)*$pageline." , ".$pageline." ";
            echo $dcfg['debug']==true?$sql:'';
            //数据
            mysql_query("Set Names '".DEFAULT_CHARSET."' ");
            $result = mysql_query($sql);
            while ($temp = mysql_fetch_array($result))
            {


            	//Jc($temp);
            	echo <<<EQT
					<tr id="tr_{$temp['id']}" onclick="/*click_for_tr('{$temp['id']}')*/" onmouseover="out_background=this.style.background;this.style.background='#ABC7EC';" onmouseout="this.style.background=out_background;">
					<td align="center"><input id="del_{$temp['id']}" name="del[{$temp['id']}]" type="checkbox" value="1" /></td>
EQT;

                    /**
                     * 查看当前信息链接功能
                     */
                    if ($dcfg['visit']['switch']){
                        $link = $dcfg['visit']['link'];
                        if (strpos($link,':') !== false){
                            $link = preg_replace_callback("/([^\:]*)\:([0-9a-zA-Z\-\_]+)([^\:]*)/", "get_visit_link", $link);
                        }
                    ?>
                    <td align='center'>
                        <a href="<?php echo $link;?>" onclick="window.open('<?php echo $link;?>');this.blur();return false;" target="_blank" style="color:green;">预览</a>
                    </td>
                    <?php
                    }
                
            	foreach ($xuan as $key=>$value) {
	            	//屏蔽功能
            		if(in_array($key,$ban)){
            			continue;
            		}

            		if (in_array($key, $yinyong)) {
            			echo "<td height='30' align='center'>".(yinyong($key, 1, $temp[$key]))."</td>";
            		} elseif (in_array($key, $datetime)) {
            			echo "<td height='30' align='center'>".date("Y-m-d H:i:s", $temp[$key])."</td>";
            		} else {
            			if($key==$datetimeChange[$key]['field']){
            				$temp[$key]=date($datetimeChange[$key]['globalformat'],$temp[$key]);
            			}

            			/*
            			 * 这块其实可以代替上面那几个if了
            			 */
                        switch ($dcfg['structure'][$key]['ftype']){
                            case 'select':
                            case 'checkbox':
                            case 'radio':
                            case 'dselect':
                    			echo "<td height='30' align='center'>".(yinyong($key,1,$temp[$key]))."</td>";
                                break;
                            case 'fileupBic':
                            case 'fileupFs':
                                $path=$dvalue['path']==''?'/uploads/pic/':$dcfg['structure'][$key]['path'];
                                $img_file='';
                                if ($temp[$key]!=''){
                                    $img_file="<a href='{$path}{$temp[$key]}' rel='lytebox' style='border:0;'><img src='/uploads/thumb/{$temp[$key]}' alt='点击查看原图' width='50' height='30' style='border:0;'/></a>";
                                }
                    			echo "<td height='30' align='center'>{$img_file}</td>";
                                break;
                            default:
                    			echo "<td height='30' align='center'>".$temp[$key]."</td>";
                                break;
                        }
            		}

            	}
            	//权限

            	//推荐
            	$tujian = '';


					/*推荐属性*/
            		foreach ($recommend as $rkey=>$rvalue) {
		            	//屏蔽功能
	            		if(in_array($rkey,$ban)){
	            			continue;
	            		}

						if(is_array($dcfg['recommend']) && !in_array($rkey,$dcfg['recommend']) || 1){
            				$tujian .= ($temp[$rkey])?("<a  href='t.php?op=tui&did=".$dcfg['name']."&id=".$temp[id]."&zd=".$rkey."&v=0&lg={$lgk}'  title='真〖".$rvalue."〗'><img src='../img/flag_".$dcfg['structure'][$rkey]['flag'].".gif' border='0' ait='真〖".$rvalue."〗'></a>"):
            				("<a  href='t.php?op=xiao&did=".$dcfg['name']."&id=".$temp[id]."&zd=".$rkey."&v=1&lg={$lgk}'  title='假〖".$rvalue."〗'><img src='../img/flag_white.gif' border='0' ait='假〖".$rvalue."〗'></a>");
						}
            		}
            		echo "<td height='30' align='center'>";

					//是否可以修改
					if($dcfg['change']!=1 || in_array($_SESSION['userinfo']['user'],$noCheck)){
						if ($_GET['did']==2) {
								echo "
							<a href='#' title='编辑〖EDIT〗'><img src='../img/edit.gif' border='0' ait='编辑〖EDIT〗' onCLick=\"if(confirm('是否进入傻瓜配置?')){window.location='modify.php?did={$temp['id']}&from=b&mid={$_GET[mid]}&pagename=page{$lgk}&lg={$lgk}&page{$lgk}={$_GET[page.$lgk]}';}else{window.location='c.php?did=".$_GET['did']."&gid=".$temp['gid']."&from=b&mid={$_GET[mid]}';}\" /></a>";
						}else{
							echo "
							<a href='c.php?did=".$_GET['did']."&gid=".$temp['gid']."{$isbdda3b}&pagename=page{$lgk}&lg={$lgk}&page{$lgk}={$_GET[page.$lgk]}' title='编辑〖EDIT〗'><img src='../img/edit.gif' border='0' ait='编辑〖EDIT〗'></a>";
						}
					}

					//是否可以删除
					if($dcfg['del']!=1 || in_array($_SESSION['userinfo']['user'],$noCheck)){
						echo "
            			<a href='d.php?did=".$_GET['did']."&id=".$temp['id']."&lg={$lgk}' onclick=\"return confirm('你确定要删除？删除后将无法恢复！')\" title='删除〖DELETE〗'><img src='../img/delete.gif' border='0' ait='删除〖DELETE〗'></a>";
					}

					//是否可以查看
					//if(!isset($dcfg['view']) || $dcfg['view']==1 || in_array($_SESSION['userinfo']['user'],$noCheck)){
					if($dcfg['view']!=1 || in_array($_SESSION['userinfo']['user'],$noCheck)){
						echo "
            			<a href='s.php?did=".$_GET['did']."&gid=".$temp['gid']."$isbdda3b&pagename=page{$lgk}&lg={$lgk}&page{$lgk}={$_GET[page.$lgk]}' title='浏览〖LIST〗 title='查看【SHOW】'><img src='../img/page_html.gif' border='0' ait='查看【SHOW】'></a>";
					}

					//附属功能
					//Jc($temp);
					$bind_had='';
					if($bind){
						$bind_had=1;
					}else{
						//Jc($temp);
						foreach($bind_filter as $bfkey=>$bfvalue){
			            	//屏蔽功能
		            		if(in_array($bfkey,$ban)){
		            			continue;
		            		}
							if(in_array($temp[$bfvalue['field']],$bind_filter_arr)){
								$bind_had=1;
							}
						}
					}
					if($bind_had){
						echo "<a  href='#' onClick=\"showorhidden(document.getElementById('p".$temp[id]."'))\" title='扩展〖EXTENSIONS〗'><img src='../img/list_extensions.gif' border='0' ait='扩展〖EXTENSIONS〗'></a>";
					}
            		echo "{$tujian}</td></tr>";
					/*echo "
            		".(($bind)?("<a  href='#' onClick=\"showorhidden(document.getElementById('p".$temp[id]."'))\" title='扩展〖EXTENSIONS〗'><img src='../img/list_extensions.gif' border='0' ait='扩展〖EXTENSIONS〗'></a>"):
            			("")).$tujian."
            		</td>";*/

            		if ($bind_had) {
						echo "<tbody name='q".$temp[id]."' id='p".$temp[id]."' style=\"display:none;\">
								  <tr><td height='20' colspan=16 bgColor=#ffffff align='right'>
									<div  style=\"margin-right:20px;\">";
						/*附属[1]*/
						foreach ($bind as $bkey=>$bvalue) {
			            	//屏蔽功能
		            		if(in_array($bkey,$ban)){
		            			continue;
		            		}

							/*echo $bvalue."【
								<a href='c.php?did=".$dcfg['structure'][$bkey]['did']."&bdb=".$_GET['did']."&bdid=".$temp[gid]."&comment=".urlencode($bvalue['COMMENT'])."' title='添加".$dvalue['COMMENT']."【AddBind】'><img src='../img/image_new.gif' border='0' ait='添加".$dvalue."【AddBind】'></a>
								<a href='###' onclick='window.parent.tab.add({\"id\":\"edit_".$temp[gid]."\",\"title\":\"附属查看\",closable:true,html:\"<iframe scrolling=\'auto\' frameborder=\'0\' width=\'100%\' height=\'100%\' src=\'/admin/mod/l.php?did=".$dcfg['structure'][$bkey]['did']."&bdb=".$_GET['did']."&bdid=".$temp[gid]."&comment=".urlencode($dvalue['COMMENT'])."\'></iframe>\"});window.parent.tab.setActiveTab(\"edit_".$temp[gid]."\");' title='浏览".$dvalue['COMMENT']."【Listbind】'><img src='../img/image.gif' border='0' ait='浏览".$dvalue['COMMENT']."【Listbind】'></a>
								】";*/
							echo $bvalue;
							//$bvalue['COMMENT']=urlencode($bvalue['COMMENT']);
							echo <<<EQT
							【
								<a href='###' onclick='window.parent.tab.add({"id":"add_{$bkey}_{$temp[gid]}","title":"附属[{$bvalue}]添加",closable:true,html:"<iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"/admin/mod/c.php?did={$dcfg['structure'][$bkey]['did']}&bdb={$_GET['did']}&bdid={$temp[gid]}&comment={$bvalue['COMMENT']}&from=b&mid={$_GET['mid']}\"></iframe>"});window.parent.tab.setActiveTab("add_{$bkey}_{$temp[gid]}");'  title='添加{$dvalue['COMMENT']}【AddBind】'><img src='../img/image_new.gif' border='0' ait='添加{$dvalue}【AddBind】'></a>
								<a href='###' onclick='window.parent.tab.add({"id":"view_{$bkey}_{$temp[gid]}","title":"附属[{$bvalue}]查看",closable:true,html:"<iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"/admin/mod/l.php?did={$dcfg['structure'][$bkey]['did']}&bdb={$_GET['did']}&bdid={$temp[gid]}&comment={$dvalue['COMMENT']}&from=b&mid={$_GET['mid']}\"></iframe>"});window.parent.tab.setActiveTab("view_{$bkey}_{$temp[gid]}");' title='浏览{$dvalue['COMMENT']}【Listbind】'><img src='../img/image.gif' border='0' ait='浏览{$dvalue['COMMENT']}【Listbind】'></a>
								】
EQT;

						}
                        /*
                         * 时时房态
                         */
                        if($_GET['did']==34){
                            echo <<<EQT
							【
								<a href='###' onclick='window.parent.tab.add({"id":"add_{$bkey}_{$temp[gid]}","title":"附属[{$bvalue}]添加",closable:true,html:"<iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"/admin/info/real_time.php?did={$dcfg['structure'][$bkey]['did']}&bdb={$_GET['did']}&bdid={$temp[gid]}&comment={$bvalue['COMMENT']}&from=b&mid={$_GET['mid']}\"></iframe>"});window.parent.tab.setActiveTab("add_{$bkey}_{$temp[gid]}");'  title='添加{$dvalue['COMMENT']}【AddBind】'>实时房价管理</a>
								】
EQT;
                        }
						/*附属[2]*/
						foreach ($bind_filter as $bkey=>$bvalue) {
			            	//屏蔽功能
		            		if(in_array($bkey,$ban)){
		            			continue;
		            		}
		            		if(in_array($temp[$bvalue['field']],preg_split("/,|#/",$bvalue['data']))){
								echo $bvalue['COMMENT'];
								echo <<<EQT
								【
									<a href='###' onclick='window.parent.tab.add({"id":"add_{$bkey}_{$temp[gid]}","title":"附属[{$bvalue['COMMENT']}]添加",closable:true,html:"<iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"/admin/mod/c.php?did={$dcfg['structure'][$bkey]['did']}&bdb={$_GET['did']}&bdid={$temp[gid]}&comment={$bvalue['COMMENT']}&from=b&mid={$_GET['mid']}\"></iframe>"});window.parent.tab.setActiveTab("add_{$bkey}_{$temp[gid]}");'  title='添加{$bvalue['COMMENT']}【AddBind】'><img src='../img/image_new.gif' border='0' ait='添加{$dvalue['COMMENT']}【AddBind】'></a>
									<a href='###' onclick='window.parent.tab.add({"id":"view_{$bkey}_{$temp[gid]}","title":"附属[{$bvalue['COMMENT']}]查看",closable:true,html:"<iframe scrolling=\"auto\" frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"/admin/mod/l.php?did={$dcfg['structure'][$bkey]['did']}&bdb={$_GET['did']}&bdid={$temp[gid]}&comment={$bvalue['COMMENT']}&from=b&mid={$_GET['mid']}\"></iframe>"});window.parent.tab.setActiveTab("view_{$bkey}_{$temp[gid]}");' title='浏览{$bvalue['COMMENT']}【Listbind】'><img src='../img/image.gif' border='0' ait='浏览{$bvalue['COMMENT']}【Listbind】'></a>
									】
EQT;

							}
						}



									echo "</div>
								</td></tr></tbody>
						";
					}

            		}
            		mysql_free_result($result);

            ?>
        </table>
		<div>┖━─&nbsp;
			<a href="###" onclick="select_all(true,'<?php echo $lgk;?>');" style="color:#9c9c9c;">全选</a>/
			<a  href="###" onclick="select_all(false,'<?php echo $lgk;?>');" style="color:#9c9c9c;">取消</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<?php
			if($dcfg['del']!=1 || in_array($_SESSION['userinfo']['user'],$noCheck)){
				echo '
					<a href="###" onclick="delete_all(\''.$lgk.'\',\''.$lgk.'\');" style="color:red;">删除</a>';
			}
		    ?>
		</div>
		</form>
        <div align="center">
            <fieldset>
                <legend>
                    分页浏览
                </legend>
                <?php
                echo $ajaxpage->show(1);
                ?>
            </fieldset>
        </div>
        <?php
        $xhgs++;
        echo "</div>";
        }
	}
        ?>
    </div>
    </body>
    <script language="javascript">
        function uptag(tagid)
        {
        //document.getElementById('loading').innerHTML="<table><tr nowrap=\"nowrap\" class=\"firstalt\"><td colspan=2><img src=\"/includes/sysimg/loading.gif\"/></td></tr></table>";
        //xajax_updatetag(tagid,'<?php echo $dcfg['name'];?>');
        }
        //switchTag('tag<?php echo $_SESSION[$dcfg['name']];?>','content<?php echo $_SESSION[$dcfg['name']];?>');
        function showorhidden(nodeObject){
              if (nodeObject.style.display == '' || nodeObject.style.display ==
        'block') {
                nodeObject.style.display = 'none';
              } else {
                nodeObject.style.display = '';
              }
            }

		function select_all(t,i) {
			if(t){
				$('#l_form_id_'+i+' input[type="checkbox"]').attr('checked',true);
			}else{
				$('#l_form_id_'+i+' input[type="checkbox"]').attr('checked',false);
			}
		}
		function delete_all(i,lg) {
			if (!confirm("您确定要删除吗?\n此操作不可恢复!")) {
				return ;
			}
			var D=$('#l_form_id_'+i).serialize();
			$.ajax({
				type:'post',
				url:'l.php?model=del',
				data:D+"&table=<?php echo $dcfg['name'];?>",
				success:function(R){
					if (R!='') {
						alert(R);
					}else{
						window.location='l.php?<?php echo get_url_parameter('lg').'&lg=';?>'+lg;
					}
				}
			});
		}
    </script>
</html>
